<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <style>
        label{
          display: block;
          margin:10px;
        }
      </style>
</head>
<body>
    <%-include common%>
    <div>
        <h2>欢迎登录</h2>
        <button onclick="history.go(-1)">返回上一级</button>
        <form action="/users/login" method="GET">
            <div>
                <label for="name">
                    用户名：<input type="text" name="name" id="name" value="<%- name %>" placeholder="请输入用户名">
                </label>
            </div>
          <div>
            <label for="pass">
                密码：<input type="text" name="pass" id="pass" placeholder="请输入用户名">
            </label>
          </div>
          <div>
              <label >
                <button type="submit" >提交登录</button>
                <button type="reset" >重置</button>
                <button type="button" id="mybtn">ajax登录</button>
              </label>
          </div>
                       
                        
                    </form>
    </div>

    <script>
        $('#mybtn').click(function(){
            $.ajax({
                url:'/users/signin',
                type:'POST',
                data:{
                    name:$('#name').val(),
                    pass:$('#pass').val(),
                },
                success:res=>{
                   console.log(res); 
                }
            })
        })
    </script>
</body>
</html>